<%--
  Created by IntelliJ IDEA.
  User: 叶叶
  Date: 2022/1/6
  Time: 18:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>产品生产工序设计单审核</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
    <script src="../js/bootstrap-table-zh-CN.min.js"></script>
</head>
<body>
<div class="container" id="div1">
    <span style="color: blue;font-family: 华文宋体"><marquee width=400 direction=left align=middle><span>您正在做的业务是：生产管理--产品生产工序设计--产品生产工序设计单审核</span></marquee></span>
    <!--      <div class="row" style="margin-top: 20px">-->
    <!--          <div class="col-10">-->
    <!--          </div>-->
    <!--          <div class="col-2">-->
    <!--              <button class="btn btn-primary" data-toggle="modal" data-target="#myModal" onclick="add1()">添加</button>-->
    <!--          </div>-->
    <!--      </div>-->
    <div class="container">
        <div class="row">
        <caption>
            <div style="float: right;margin-bottom: 5px">
            </div>
        </caption>
        <table id="table" class="table table-hover table-bordered" style="width: 1100px">
            <thead>
            <tr align="center">
                <th>设计单编号</th>
                <th>产品编号</th>
                <th>产品名称</th>
                <th>设计人</th>
                <th>登记时间</th>
                <th>工时总成本</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

        </table>
    </div>
        </div>
    </div>
</div>
<DIV class=DIV_STYLE2 style="display: none" id="div2"><TABLE cellSpacing=0 cellPadding=0 width=1000 align=center bgColor=#ffffff border=0 >
    <div style="position: relative;left: 60%">

        <input class="RADIO_STYLE1" name="tg"  type="radio" value="S001-2">未通过
        <input class="RADIO_STYLE1" name="tg"  type="radio" value="S001-1">通过
        <input  onclick="queren()" class="btn3_mouseout" type=button value=确认>
        <input  onclick="fanhui()" class="btn3_mouseout" type=button value=返回>
    </div>
    <TBODY>
    <TR>
        <TD class=TABLE_STYLE6 vAlign=bottom rowSpan=2 align=center>
            <TABLE style="BORDER-TOP: #333333 1px solid; BORDER-RIGHT: #333333 1px solid; BORDER-BOTTOM: #333333 1px solid; BORDER-LEFT: #333333 1px solid" cellSpacing=0 cellPadding=0 width="100%" border=0>
                <TBODY>
                <TR>
                    <TD height=10 colSpan=4>
                        <TABLE width="100%">
                            <TBODY>
                            <TR>
                                <TD>
                                    <table align="center">
                                        <tr>
                                            <td><h3>生产工序设计单</h3></td>
                                        </tr>
                                    </table>
                                    <br>
                                    <div>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>产品名称:</span>
                                        <span id="cpmc"></span>
                                        <span style="position: relative;left:300px;">产品编号:<span id="cpbh"></span></span>
                                        <br>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>设计人:<input style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 40%;outline:none" id="sjr"></span>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>设计单编号:<span id="sjbh"></span></span>
                                    </div>
                                    <br>
                                    <TABLE id=tableOnlineEdit class=TABLE_STYLE5 borderColor=#000000  cellSpacing=0 cols=1 borderColorDark=#eeeeee cellPadding=0 align=center borderColorLight=#848284 border=1><THEAD>
                                    <TR class=TR_STYLE2 height="10" bgColor=#d2e9ff>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="7%" align=left>编号</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>工序名称</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>工序编号</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="7%" align=left>描述</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>工时数</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>工时单位</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="19%" align=left>单位工时成本</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="22%" align=left>工时成本小计(元)</TD></TR>
                                    <%--                                    <TR class=TR_STYLE1  height=20>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT id=checkLine class=CHECKBOX_STYLE1 type=checkbox value=on name=checkbox></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT onfocus=this.blur() class=INPUT_STYLE4 name=procedure_name>fds</TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT onfocus=this.blur() class=INPUT_STYLE4 name=procedure_ID>fds</TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><SPAN style="WIDTH: 120px; BACKGROUND: #ffffff" name="product_describe_ok"></SPAN><INPUT onfocus=this.blur() class=INPUT_STYLE4 type=hidden name=procedure_describe></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT class=INPUT_STYLE5 name=labour_hour_amount></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT class=INPUT_STYLE5 name=amount_unit></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT class=INPUT_STYLE5 name=cost_price></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left>&nbsp;</TD></TR>
                                                --%>
                                    </THEAD>
                                    </TABLE>
                                    <br>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <span>工时总成本:<span id="zcb"></span></span>
                                    <div>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>审核人:<input style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 40%;outline:none" id="djr"></span>
                                        &nbsp;&nbsp;&nbsp;&nbsp;
                                        <span style="position: relative;left:200px;">审核时间:<span id="shijian"></span></span>
                                    </div>
                                    <br>

                                    <div>
                                        <div>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <span style="position: relative;top: -40px">设计要求:</span><textarea style="resize: none" rows=4 cols="100" id="sjyq"></textarea>
                                        </div>
                                    </div>
                                </TD></TR></TBODY></TABLE></TD></TR>
                <TR>
                    <TD width=56 colSpan=3 noWrap></TD></TR>
                <TR>
                    <TD height=100 colSpan=3 noWrap></TD>
                    <TD></TD></TR>
                <TR vAlign=bottom>
                    <TD colSpan=4 noWrap align=center></TD></TR></TD>
                <TR>
                    <TD colSpan=4 noWrap align=right></TD></TR></TBODY></TABLE></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD></TR>
    <TR>
        <TD bgColor=#333333 height=120 width=1></TD>
        <TD bgColor=#666666 height=120 width=1></TD>
        <TD bgColor=#999999 height=120 width=1></TD></TR>
    <TR align=right vAlign=top>
        <TD colSpan=4>
            <TABLE class=TABLE_STYLE6 cellSpacing=0 cellPadding=0 align=center border=0>
                <TBODY>
                <TR>
                    <TD bgColor=#333333 height=1></TD></TR>
                <TR>
                    <TD bgColor=#666666 height=1></TD></TR>
                <TR>
                    <TD bgColor=#999999 height=1></TD></TR></TBODY></TABLE></TD></TR>
    <TR align=right vAlign=middle>
        <TD colSpan=4></TD></TR></TBODY></TABLE></DIV>

<script>
    $(function () {
        $("#table").bootstrapTable({
            method:"post",
            //请求类型
            contentType:"application/json",
            //请求地址
            url:"/cha/sh",
            striped:true,
            //初始页数
            pageNumber:1,
            pagination: true,
            sidePagination:"server",
            pageSize:2,
            pageList:[2,4,6,8,10],
            queryParams:function (param) {
                return {
                    page: (param.offset / param.limit) + 1,
                    pageNum: param.limit,
                }
            },
            columns:[
                {title:"设计单编号",field:"designId",align:"center"},
                {title:"产品编号",field:"productId",align:"center"},
                {title:"产品名称",field:"productName",align:"center"},
                {title:"设计人",field:"designer",align:"center"},
                {title:"登记时间",field:"registerTime",align:"center"},
                {title:"工时总成本",field:"costPriceSum",align:"center"},
                {title:"操作",field:"",align:"center",
                    formatter:function (value, row, index) {
                        var btn2="<button class='btn btn-info'  onclick='update1("+row.productId+")'>审核</button>";
                        return btn2;
                    }}
            ]
        })
    })
    function update1(productId) {
            document.getElementById("div1").style.display='none'
        document.getElementById("div2").style.display='block'
        var myDate = new Date();
        year = myDate.getYear()+1900;
        month = myDate.getMonth()+1;
        date = myDate.getDate();
        hour = myDate.getHours();
        minute =myDate.getMinutes();
        second = myDate.getSeconds();
        $.ajax({
            type:"get",
            url: "/cha/sj/"+productId,
            dataType:"json",
            success:function (data) {
                for (var i=0;data.length;i++) {
                    console.log(data[i].mDesignProcedureDetailsList)
                    console.log(data[i].register)
                    document.getElementById("sjyq").innerText = data[i].procedureDescribe
                    document.getElementById("zcb").innerText = data[i].costPriceSum
                    document.getElementById("sjbh").innerText = data[i].designId
                    document.getElementById("cpmc").innerText = data[i].productName
                    document.getElementById("cpbh").innerText = data[i].productId
                    document.getElementById("djr").value = data[i].designer
                        document.getElementById("sjr").value=data[i].register
                    document.getElementById("shijian").innerText=year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second
                    var xx = data[i].mDesignProcedureDetailsList;
                    for (var i=0;xx.length;i++) {
                        document.getElementById("tableOnlineEdit").innerHTML +=
                            "<tr>" +
                            "<td>" + xx[i].mid + "</td>" +
                            "<td>" + xx[i].procedureName + "</td>" +
                            "<td>" + xx[i].procedureId + "</td>" +
                            "<td></td>" +
                            "<td>" + xx[i].labourHourAmount + "</td>" +
                            "<td>" + xx[i].amountUnit + "</td>" +
                            "<td>" + xx[i].costPrice + "</td>" +
                            "<td>" + xx[i].subtotal + "</td>" +
                            "</tr>"

                    }
                }
            },error:function (data) {
                console.log("Xxx")
            }
        })

    }
    function queren() {
        let productId = document.getElementById("cpbh").innerText;
        var aa = document.getElementsByName("tg");
        for (var i=0; i<aa.length; i++)
        {
            if(aa[i].checked) {
                var checkTag = aa[i].value;
            }
        }
        var xx ={
            productId:document.getElementById("cpbh").innerText,
            checkTag:checkTag
        }
        let s = JSON.stringify(xx);
        $.ajax({
            type:"post",
            url: "/cha/up/",
            dataType:"json",
            contentType: "application/json",
            data:s,
            success:function (data) {
                document.getElementById("div1").style.display='block'
                document.getElementById("div2").style.display='none'
                $("#table").bootstrapTable("refresh")
            },error:function (data) {
                console.log("Xxx")
            }
        })
    }
    function fanhui() {
        $("#table").bootstrapTable("refresh")
    }
    function fanhui() {
        document.location="pnaudit.jsp"
    }
</script>
</body>
</html>
